package common;

import java.util.Vector;

public class Buffer extends Vector {
  private static final long serialVersionUID = -1495581830816272026L;

  public Buffer() {
    super();
  }
  
  public void push(StepData data) {
    add(data);
  }
  
  public StepData pop() {
    StepData data = null;
    try {
      data = (StepData)remove(0); 
    }
    catch (ArrayIndexOutOfBoundsException ex) {
      //do nothing, the caller should handle a null pop to mean the buffer is empty
    }
    return data;
  }
  
  public void reset() {
    removeAllElements();
  }

}